fix: ignore weak symbols in get_undefined_symbols#665
Merged
Conversation
Undefined symbols with weak binding are likely optional in runtime. Don't treat them as undefined in auditwheel context.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #665 +/- ##
=======================================
Coverage 95.24% 95.24%
=======================================
Files 22 22
Lines 1829 1829
Branches 343 343
=======================================
Hits 1742 1742
Misses 48 48
Partials 39 39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the handling of weak symbols in ELF binaries by excluding them from the set of undefined symbols. Weak symbols are optional at runtime and should not be treated as required dependencies when checking against blacklisted symbols.
- Modified
get_undefined_symbols()to filter out weak symbols (STB_WEAK binding) - Added test to verify that wheels with weak symbols are not incorrectly rejected
- Refactored wheel download logic in noxfile.py to support downloading multiple test wheels
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/auditwheel/elfutils.py | Added check to exclude weak symbols (STB_WEAK) from undefined symbols list |
| tests/integration/test_bundled_wheels.py | Added test validating that cryptography wheel with weak symbols passes manylinux policy check |
| noxfile.py | Refactored pip download commands into reusable _download_wheels_for_tests() function to download both patchelf and cryptography test wheels |
| .gitignore | Added ignore entry for the cryptography test wheel downloaded by noxfile |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b4bcaf8 to
b80234d
Compare
Merged
messense
pushed a commit
to PyO3/maturin
that referenced
this pull request
Jan 6, 2026
PR #2901 updated the manylinux policies, which now include `__cxa_thread_atexit_impl`. This symbol is [linked weakly](https://github.com/rust-lang/rust/blob/4fa80a5e733e2202d7ca4c203c2fdfda41cfe7dc/library/std/src/sys/thread_local/destructors/linux_like.rs#L4) by the Rust stdlib. Rather than requiring a bump of the minimum manylinux platform tag for users, ignore weak symbols in the check. This is in line with changes to PyPA's auditwheel (pypa/auditwheel#665).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Undefined symbols with weak binding are likely optional in runtime. Don't treat them as undefined in auditwheel context.
fix #663
Note: the function
get_undefined_symbolsis only used to process blacklisted symbols. If the symbol is optional at runtime, we definitely don't need to blacklist it.